package com.ab.filemanager.base.adapter

import androidx.recyclerview.widget.RecyclerView
import android.view.ViewGroup
import com.anbang.app.ui.frame.study.recycleView.adapter.ClickVo

/**
 * 创建作者：AnBang
 * 创建时间：2018/7/19
 * 功能描述：
 */
open class BaseRecycleViewAdapter : RecyclerView.Adapter<BaseViewHolder>() {

    private var listener: ((ClickVo) -> Unit)? = null

    private var longClickListener: ((ClickVo) -> Unit)? = null

    private var dragListener: ((RecyclerView.ViewHolder) -> Unit)? = null

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun getItemCount(): Int {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
        holder.listener = listener
        holder.longClickListener = longClickListener
        holder.dragListener = dragListener
    }

    fun setItemClickListener(listener: (ClickVo) -> Unit) {
        this.listener = listener
    }

    fun setItemLongClickListener(listener: (ClickVo) -> Unit) {
        this.longClickListener = listener
    }

    fun setOnStartDragListener(listener: (RecyclerView.ViewHolder) -> Unit) {
        this.dragListener = listener
    }
}